#include <stdio.h> 
#include <signal.h>
#include <unistd.h>

void print(int signo)
{
	printf("捕获了信号：%d\n",signo);	//signo就是信号值
}

int main()
{	
	if(signal(SIGINT,print) == SIG_ERR)
		perror("signal 2") , exit(-1);
	signal(SIGQUIT,SIG_IGN);	//信号3被忽略 
	
	pid_t pid = vfork();		//子进程信号处理与父进程一致 
	if(pid == 0)
	{
		printf("child pid:%d\n",getpid());
		execl("./proc","proc",NULL);
	}
	
	printf("parent end\n");	
}
